<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
首页

欢迎<h1 id="userName"></h1>
</body>
</html>
<script>

    const userStr = localStorage.getItem("user")

    // localStorage.removeItem()
    const user = JSON.parse(userStr);


    // document.getElementById("userName").innerHTML = user.username;
    // console.log(user)

    window.onload = function () {
        console.log("页面加载完成")

        console.log(user == null)
        if (null == user) {
            window.location = "/static/login.html"
        }

    }



</script>